From: emellor@leeni.uk.xensource.com Date: Thu, 4 May 2006 13:22:17 +0000 (+0100) Subject: Second step toward a new network infrastructure, move XmConsole to be X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16108^2~20 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=57a3f4ca825815cc639277ab1837984f88db0de8;p=xen.git Second step toward a new network infrastructure, move XmConsole to be in XenDomain. The devices we will add, like network, will need to run console commands when a domain is started. So I have made console be a part of domain object, which it's tied to anyway. Signed-off-by: Daniel Stekloff --- diff --git a/tools/xm-test/lib/XmTestLib/Console.py b/tools/xm-test/lib/XmTestLib/Console.py index 695106be60..7a6a74548c 100755 --- a/tools/xm-test/lib/XmTestLib/Console.py +++ b/tools/xm-test/lib/XmTestLib/Console.py @@ -234,11 +234,14 @@ class XmConsole: "return": 0, } - def closeConsole(self): + def __closeConsole(self): """Closes the console connection and ensures that the console - process is killed""" - os.close(self.consoleFd) - os.kill(self.consolePid, 2) + process is killed. This should only be called by the domain. + Tests should call domain.closeConsole()""" + if self.consolePid != 0: + os.close(self.consoleFd) + os.kill(self.consolePid, 2) + self.consolePid = 0 def setLimit(self, limit): @@ -249,6 +252,10 @@ class XmConsole: self.limit = int(limit) except Exception, e: self.limit = None + + def setHistorySaveCmds(self, value): + # True or False + self.historySaveCmds = value if __name__ == "__main__": @@ -272,7 +279,7 @@ if __name__ == "__main__": print "Console failed (%)" % str(e) sys.exit(255) - t.closeConsole() + t._XmConsole__closeConsole() print run["output"], sys.exit(run["return"]) diff --git a/tools/xm-test/lib/XmTestLib/Test.py b/tools/xm-test/lib/XmTestLib/Test.py index ee49ccd358..68a176c273 100644 --- a/tools/xm-test/lib/XmTestLib/Test.py +++ b/tools/xm-test/lib/XmTestLib/Test.py @@ -173,8 +173,7 @@ def isConsoleDead(): domain = XmTestDomain() try: - domain.start() - console = XmConsole(domain.getName()) + console = domain.start() console.runCmd("ls") except DomainError, e: return True diff --git a/tools/xm-test/lib/XmTestLib/XenDomain.py b/tools/xm-test/lib/XmTestLib/XenDomain.py index d13037f0fe..e9cd1e5326 100644 --- a/tools/xm-test/lib/XmTestLib/XenDomain.py +++ b/tools/xm-test/lib/XmTestLib/XenDomain.py @@ -27,6 +27,7 @@ import time from Xm import * from Test import * from config import * +from Console import * BLOCK_ROOT_DEV = "hda" @@ -193,6 +194,8 @@ class XenDomain: self.name = getUniqueName() self.config = config + self.console = None + # Set domain type, either PV for ParaVirt domU or HVM for # FullVirt domain if ENABLE_HVM_SUPPORT: @@ -200,7 +203,7 @@ class XenDomain: else: self.type = "PV" - def start(self): + def start(self, noConsole=False): ret, output = traceCommand("xm create %s" % self.config) @@ -213,10 +216,22 @@ class XenDomain: if self.getDomainType() == "HVM": waitForBoot() + if self.console and noConsole == True: + self.closeConsole() + + elif self.console and noConsole == False: + return self.console + + elif not self.console and noConsole == False: + return self.getConsole() + def stop(self): prog = "xm" cmd = " shutdown " + if self.console: + self.closeConsole() + ret, output = traceCommand(prog + cmd + self.config.getOpt("name")) return ret @@ -225,6 +240,9 @@ class XenDomain: prog = "xm" cmd = " destroy " + if self.console: + self.closeConsole() + ret, output = traceCommand(prog + cmd + self.config.getOpt("name")) return ret @@ -238,6 +256,24 @@ class XenDomain: def getDomainType(self): return self.type + def closeConsole(self): + # The domain closeConsole command must be called by tests, not the + # console's close command. Once close is called, the console is + # gone. You can't get history or anything else from it. + if self.console: + self.console._XmConsole__closeConsole() + self.console = None + + def getConsole(self): + if self.console: + self.closeConsole() + + self.console = XmConsole(self.getName()) + # Activate the console + self.console.sendInput("input") + + return self.console + class XmTestDomain(XenDomain): diff --git a/tools/xm-test/tests/_sanity/01_domu_proc.py b/tools/xm-test/tests/_sanity/01_domu_proc.py index 56eb391bed..f283ae6b93 100644 --- a/tools/xm-test/tests/_sanity/01_domu_proc.py +++ b/tools/xm-test/tests/_sanity/01_domu_proc.py @@ -15,13 +15,11 @@ import re domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: FAIL(str(e)) try: - console = XmConsole(domain.getName()) - console.sendInput("foo") run = console.runCmd("cat /proc/cpuinfo") except ConsoleError, e: FAIL(str(e)) diff --git a/tools/xm-test/tests/block-create/01_block_attach_device_pos.py b/tools/xm-test/tests/block-create/01_block_attach_device_pos.py index 564ffad0bf..492d83f2cf 100644 --- a/tools/xm-test/tests/block-create/01_block_attach_device_pos.py +++ b/tools/xm-test/tests/block-create/01_block_attach_device_pos.py @@ -16,7 +16,7 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" @@ -25,13 +25,7 @@ except DomainError, e: # Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") + console.setHistorySaveCmds(value=True) # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -49,7 +43,7 @@ except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/block-create/02_block_attach_file_device_pos.py b/tools/xm-test/tests/block-create/02_block_attach_file_device_pos.py index 0cfb6de109..df3f0d67a6 100644 --- a/tools/xm-test/tests/block-create/02_block_attach_file_device_pos.py +++ b/tools/xm-test/tests/block-create/02_block_attach_file_device_pos.py @@ -16,22 +16,16 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it +# Set console to save commands and make sure we can run cmds try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") + console.setHistorySaveCmds(value=True) # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -49,7 +43,7 @@ except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/block-create/04_block_attach_device_repeatedly_pos.py b/tools/xm-test/tests/block-create/04_block_attach_device_repeatedly_pos.py index 8a5680f10b..a3b9785785 100644 --- a/tools/xm-test/tests/block-create/04_block_attach_device_repeatedly_pos.py +++ b/tools/xm-test/tests/block-create/04_block_attach_device_repeatedly_pos.py @@ -16,22 +16,15 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") + console.setHistorySaveCmds(value=True) # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -49,7 +42,7 @@ for i in range(10): FAIL("Device is not actually attached to domU") # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/block-create/05_block_attach_and_dettach_device_repeatedly_pos.py b/tools/xm-test/tests/block-create/05_block_attach_and_dettach_device_repeatedly_pos.py index 1434ad2176..7f7fe77ead 100644 --- a/tools/xm-test/tests/block-create/05_block_attach_and_dettach_device_repeatedly_pos.py +++ b/tools/xm-test/tests/block-create/05_block_attach_and_dettach_device_repeatedly_pos.py @@ -16,22 +16,15 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") + console.setHistorySaveCmds(value=True) # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -57,7 +50,7 @@ for i in range(10): FAIL("Failed to dettach block device: /proc/partitions still showing that!") # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py b/tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py index ac179d50a3..2c6b19e54a 100644 --- a/tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py +++ b/tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py @@ -16,22 +16,15 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") + console.setHistorySaveCmds(value=True) # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -53,7 +46,7 @@ except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py b/tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py index 2a908c3295..8c129bd2a3 100644 --- a/tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py +++ b/tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py @@ -16,22 +16,15 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") + console.setHistorySaveCmds(value=True) # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -52,7 +45,7 @@ except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py b/tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py index 4bcfd863f3..bcfb4fe26c 100644 --- a/tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py +++ b/tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py @@ -16,22 +16,15 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") + console.setHistorySaveCmds(value=True) # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -72,7 +65,7 @@ for i in range(10): FAIL("Failed to dettach block device: /proc/partitions still showing that!") # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/block-create/10_block_attach_dettach_multiple_devices.py b/tools/xm-test/tests/block-create/10_block_attach_dettach_multiple_devices.py index 4c3b4d1851..b538e3d936 100644 --- a/tools/xm-test/tests/block-create/10_block_attach_dettach_multiple_devices.py +++ b/tools/xm-test/tests/block-create/10_block_attach_dettach_multiple_devices.py @@ -53,22 +53,15 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") + console.setHistorySaveCmds(value=True) # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -103,7 +96,7 @@ while i < ramdisks or devices: FAIL(msg) # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py b/tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py index e3f76c1985..1e465b3c37 100644 --- a/tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py +++ b/tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py @@ -12,15 +12,14 @@ config = {"disk":"phy:/dev/ram0,hda1,w"} domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print e.extra FAIL("Unable to create domain") try: - console = XmConsole(domain.getName(), historySaveCmds=True) - console.sendInput("input") + console.setHistorySaveCmds(value=True) run = console.runCmd("cat /proc/partitions | grep hda1") run2 = console.runCmd("cat /proc/partitions") except ConsoleError, e: @@ -41,7 +40,7 @@ except ConsoleError, e: saveLog(console.getHistory()) FAIL(str(e)) -console.closeConsole() +domain.closeConsole() domain.stop() if run["return"] == 0: diff --git a/tools/xm-test/tests/block-destroy/02_block-destroy_rtblock_pos.py b/tools/xm-test/tests/block-destroy/02_block-destroy_rtblock_pos.py index db918b7634..4055c7d887 100644 --- a/tools/xm-test/tests/block-destroy/02_block-destroy_rtblock_pos.py +++ b/tools/xm-test/tests/block-destroy/02_block-destroy_rtblock_pos.py @@ -11,7 +11,7 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print e.extra @@ -23,12 +23,6 @@ if status != 0: pass try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - FAIL(str(e)) - -try: - console.sendInput("input") run = console.runCmd("cat /proc/partitions | grep hda1") except ConsoleError, e: saveLog(console.getHistory()) @@ -47,7 +41,7 @@ except ConsoleError, e: saveLog(console.getHistory()) FAIL(str(e)) +domain.stop() + if run["return"] == 0: FAIL("block-detach failed to detach block device") - - diff --git a/tools/xm-test/tests/block-destroy/04_block-destroy_nonattached_neg.py b/tools/xm-test/tests/block-destroy/04_block-destroy_nonattached_neg.py index 6fea02864f..eea2027771 100644 --- a/tools/xm-test/tests/block-destroy/04_block-destroy_nonattached_neg.py +++ b/tools/xm-test/tests/block-destroy/04_block-destroy_nonattached_neg.py @@ -13,7 +13,7 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print e.extra diff --git a/tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py b/tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py index 5e2587e35f..3f43fe9d95 100644 --- a/tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py +++ b/tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py @@ -12,15 +12,13 @@ config = {"disk":"phy:/dev/ram0,hda1,w"} domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print e.extra FAIL("Unable to create domain") try: - console = XmConsole(domain.getName(), historySaveCmds=True) - console.sendInput("input") run = console.runCmd("cat /proc/partitions | grep hda1") run2 = console.runCmd("cat /proc/partitions") except ConsoleError, e: @@ -41,7 +39,7 @@ except ConsoleError, e: saveLog(console.getHistory()) FAIL(str(e)) -console.closeConsole() +domain.closeConsole() domain.stop() if run["return"] == 0: diff --git a/tools/xm-test/tests/block-list/01_block-list_pos.py b/tools/xm-test/tests/block-list/01_block-list_pos.py index d176be82f7..05df76c189 100644 --- a/tools/xm-test/tests/block-list/01_block-list_pos.py +++ b/tools/xm-test/tests/block-list/01_block-list_pos.py @@ -15,7 +15,7 @@ config = {"disk":"phy:/dev/ram0,hda1,w"} domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print e.extra @@ -31,16 +31,12 @@ elif where < 0: #Verify the block device on DomainU try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - FAIL(str(e)) - -try: - console.sendInput("input") run = console.runCmd("cat /proc/partitions | grep hda1") except ConsoleError, e: saveLog(console.getHistory()) FAIL(str(e)) +domain.stop() + if run["return"] != 0: FAIL("Failed to verify that block dev is attached on DomainU") diff --git a/tools/xm-test/tests/block-list/02_block-list_attachbd_pos.py b/tools/xm-test/tests/block-list/02_block-list_attachbd_pos.py index 8a8459938e..c189dbe335 100644 --- a/tools/xm-test/tests/block-list/02_block-list_attachbd_pos.py +++ b/tools/xm-test/tests/block-list/02_block-list_attachbd_pos.py @@ -14,7 +14,7 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print e.extra @@ -36,16 +36,12 @@ elif where < 0 : #Verify attached block device on DomainU try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - FAIL(str(e)) - -try: - console.sendInput("input") run = console.runCmd("cat /proc/partitions | grep hda1") except ConsoleError, e: saveLog(console.getHistory()) FAIL(str(e)) +domain.stop() + if run["return"] != 0: FAIL("Failed to verify that block dev is attached on DomainU") diff --git a/tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py b/tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py index 26e42097a4..1556b065ef 100644 --- a/tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py +++ b/tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py @@ -15,7 +15,7 @@ config = {"disk":"phy:/dev/ram0,hda1,w"} domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print e.extra @@ -43,16 +43,12 @@ elif (where1 < 0) and (where2 < 0): #Verify attached block device on DomainU try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - FAIL(str(e)) - -try: - console.sendInput("input") run = console.runCmd("cat /proc/partitions | grep hda1;cat /proc/partitions | grep hda2") except ConsoleError, e: saveLog(console.getHistory()) FAIL(str(e)) +domain.stop() + if run["return"] != 0: FAIL("Failed to verify that block dev is attached on DomainU") diff --git a/tools/xm-test/tests/block-list/04_block-list_nodb_pos.py b/tools/xm-test/tests/block-list/04_block-list_nodb_pos.py index ae5e4f51ac..131eee712d 100644 --- a/tools/xm-test/tests/block-list/04_block-list_nodb_pos.py +++ b/tools/xm-test/tests/block-list/04_block-list_nodb_pos.py @@ -14,7 +14,7 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print e.extra diff --git a/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py b/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py index ccdbe5c816..5cba6f49b5 100644 --- a/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py +++ b/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py @@ -11,15 +11,10 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + domain.start(noConsole=True) except DomainError, e: FAIL(str(e)) -try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - FAIL(str(e)) - s, o = traceCommand("xm block-list %s" % domain.getName()) if s != 0: FAIL("block-list returned !0 when no devices attached") @@ -72,4 +67,4 @@ if o.find("770") != -1: if o: FAIL("block-list still shows something after all devices detached!") - +domain.stop() diff --git a/tools/xm-test/tests/create/01_create_basic_pos.py b/tools/xm-test/tests/create/01_create_basic_pos.py index 7a45df2de4..20bf533b36 100644 --- a/tools/xm-test/tests/create/01_create_basic_pos.py +++ b/tools/xm-test/tests/create/01_create_basic_pos.py @@ -18,37 +18,29 @@ if int(getInfo("free_memory")) < domain.config.getOpt("memory"): # Start it try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: saveLog(console.getHistory()) FAIL(str(e)) + +# Save a transcript for human review +saveLog(console.getHistory()) # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() -# Save a transcript for human review -saveLog(console.getHistory()) - # Check the output of 'ls' if not re.search("proc", run["output"]): diff --git a/tools/xm-test/tests/create/04_create_conflictname_neg.py b/tools/xm-test/tests/create/04_create_conflictname_neg.py index 15b78397cf..e141a3bd81 100644 --- a/tools/xm-test/tests/create/04_create_conflictname_neg.py +++ b/tools/xm-test/tests/create/04_create_conflictname_neg.py @@ -17,7 +17,7 @@ domain1 = XmTestDomain("default") #start it try: - domain1.start() + domain1.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain1 because:" @@ -30,7 +30,7 @@ domain2 = XmTestDomain("default") #start it eyecatcher = "Pass" try: - domain2.start() + domain2.start(noConsole=True) except DomainError, e: eyecatcher = "Fail" # Stop the domain1 (nice shutdown) diff --git a/tools/xm-test/tests/create/06_create_mem_neg.py b/tools/xm-test/tests/create/06_create_mem_neg.py index 6f7193636b..f8bc946bcd 100644 --- a/tools/xm-test/tests/create/06_create_mem_neg.py +++ b/tools/xm-test/tests/create/06_create_mem_neg.py @@ -23,7 +23,7 @@ config1 = {"memory": 0} domain1=XmTestDomain(extraConfig=config1) try: - domain1.start() + domain1.start(noConsole=True) eyecatcher1 = "Created" except DomainError, e: eyecatcher1 = "Fail" @@ -42,7 +42,7 @@ config2 = {"memory": extreme_mem} domain2=XmTestDomain(extraConfig=config2) try: - domain2.start() + domain2.start(noConsole=True) eyecatcher2 = "Created" except DomainError, e: eyecatcher2 = "Fail" diff --git a/tools/xm-test/tests/create/07_create_mem64_pos.py b/tools/xm-test/tests/create/07_create_mem64_pos.py index d801b8a8b0..ae2f84adb1 100644 --- a/tools/xm-test/tests/create/07_create_mem64_pos.py +++ b/tools/xm-test/tests/create/07_create_mem64_pos.py @@ -28,7 +28,7 @@ domain_mem64=XmTestDomain(extraConfig=config) #start it try: - domain_mem64.start() + domain_mem64.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain_mem64 because:" diff --git a/tools/xm-test/tests/create/08_create_mem128_pos.py b/tools/xm-test/tests/create/08_create_mem128_pos.py index a830c7dc8e..0d50006b36 100644 --- a/tools/xm-test/tests/create/08_create_mem128_pos.py +++ b/tools/xm-test/tests/create/08_create_mem128_pos.py @@ -28,7 +28,7 @@ domain_mem128=XmTestDomain(extraConfig=config) #start it try: - domain_mem128.start() + domain_mem128.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain_mem128 because:" diff --git a/tools/xm-test/tests/create/09_create_mem256_pos.py b/tools/xm-test/tests/create/09_create_mem256_pos.py index 07d73d8127..c926d62de8 100644 --- a/tools/xm-test/tests/create/09_create_mem256_pos.py +++ b/tools/xm-test/tests/create/09_create_mem256_pos.py @@ -28,7 +28,7 @@ domain_mem256=XmTestDomain(extraConfig=config) #start it try: - domain_mem256.start() + domain_mem256.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain_mem256 because:" diff --git a/tools/xm-test/tests/create/10_create_fastdestroy.py b/tools/xm-test/tests/create/10_create_fastdestroy.py index f17d4502b9..3f392d218c 100644 --- a/tools/xm-test/tests/create/10_create_fastdestroy.py +++ b/tools/xm-test/tests/create/10_create_fastdestroy.py @@ -28,7 +28,7 @@ i = 0 for i in range(0,50): domain = XmTestDomain("testdomain") try: - domain.start() + domain.start(noConsole=True) except DomainError,e: print "Failed: " + e.extra NSPerror = check_for_NSP_error(e.extra) diff --git a/tools/xm-test/tests/create/11_create_concurrent_pos.py b/tools/xm-test/tests/create/11_create_concurrent_pos.py index 7ae74d18a6..ad5f297719 100644 --- a/tools/xm-test/tests/create/11_create_concurrent_pos.py +++ b/tools/xm-test/tests/create/11_create_concurrent_pos.py @@ -43,15 +43,13 @@ for d in range(0, NUM_DOMS): extraConfig={"memory":MEM_PER_DOM}) try: - dom.start() + cons = dom.start() except DomainError, e: if verbose: print str(e) FAIL("[%i] Failed to create domain" % d) try: - cons = XmConsole(dom.getName()) - cons.sendInput("foo") cons.runCmd("ls") except ConsoleError, e: FAIL("[%i] Failed to attach console to %s" % (d, dom.getName())) diff --git a/tools/xm-test/tests/create/12_create_concurrent_stress_pos.py b/tools/xm-test/tests/create/12_create_concurrent_stress_pos.py index 8bffb1b2c6..06b125083f 100644 --- a/tools/xm-test/tests/create/12_create_concurrent_stress_pos.py +++ b/tools/xm-test/tests/create/12_create_concurrent_stress_pos.py @@ -17,18 +17,12 @@ for i in range(0,DOMS): dom = XmTestDomain(extraConfig={"memory" : MEM}) try: - dom.start() + cons = dom.start() except DomainError, e: if verbose: print str(e) FAIL("Failed to start %s" % dom.getName()) - try: - cons = XmConsole(dom.getName()) - cons.sendInput("foo") - except ConsoleError, e: - FAIL(str(e)) - if verbose: print "[%i/%i] Started %s" % (i, DOMS, dom.getName()) @@ -56,4 +50,3 @@ for d, c in domains: if run["return"] != 0: FAIL("Domain %s didn't survive!" % d.getName()) - diff --git a/tools/xm-test/tests/create/13_create_multinic_pos.py b/tools/xm-test/tests/create/13_create_multinic_pos.py index 6f86e25f16..38c8b39f26 100644 --- a/tools/xm-test/tests/create/13_create_multinic_pos.py +++ b/tools/xm-test/tests/create/13_create_multinic_pos.py @@ -18,13 +18,11 @@ for i in range(0,MAX_NICS): domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: FAIL("(%i nics) " % i + str(e)) try: - console = XmConsole(domain.getName()) - console.sendInput("input") console.runCmd("ls") except ConsoleError, e: FAIL("(%i nics) Console didn't respond: probably crashed!" % i) diff --git a/tools/xm-test/tests/create/14_create_blockroot_pos.py b/tools/xm-test/tests/create/14_create_blockroot_pos.py index ef52ffc48a..58eeb2b9b3 100644 --- a/tools/xm-test/tests/create/14_create_blockroot_pos.py +++ b/tools/xm-test/tests/create/14_create_blockroot_pos.py @@ -31,20 +31,14 @@ else: domain = XenDomain(name=domConfig.getOpt("name"), config=domConfig) try: - domain.start() + console = domain.start() except DomainError, e: FAIL(str(e)) #waitForBoot() -try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - try: # console.debugMe = True - console.sendInput("foo") run = console.runCmd("ls") except ConsoleError, e: diff --git a/tools/xm-test/tests/create/15_create_smallmem_pos.py b/tools/xm-test/tests/create/15_create_smallmem_pos.py index 2658cf379d..faca03336b 100644 --- a/tools/xm-test/tests/create/15_create_smallmem_pos.py +++ b/tools/xm-test/tests/create/15_create_smallmem_pos.py @@ -12,13 +12,11 @@ domain = XmTestDomain(extraConfig={"memory": MEM, "extra" :"mem=%iM" % MEM}) try: - domain.start() + console = domain.start() except DomainError, e: FAIL("Unable to start a domain with %i MB" % MEM) try: - console = XmConsole(domain.getName()) - console.sendInput("input") console.runCmd("ls") except ConsoleError, e: if e.reason == RUNAWAY: diff --git a/tools/xm-test/tests/create/16_create_smallmem_neg.py b/tools/xm-test/tests/create/16_create_smallmem_neg.py index 589208580c..5bbaa6f704 100644 --- a/tools/xm-test/tests/create/16_create_smallmem_neg.py +++ b/tools/xm-test/tests/create/16_create_smallmem_neg.py @@ -13,13 +13,11 @@ domain = XmTestDomain(extraConfig={"memory": MEM, "extra" :"mem=%iM" % MEM}) try: - domain.start() + console = domain.start() except DomainError, e: FAIL("Unable to start a domain with %i MB" % MEM) try: - console = XmConsole(domain.getName()) - console.sendInput("input") console.runCmd("ls") except ConsoleError, e: if e.reason == RUNAWAY: diff --git a/tools/xm-test/tests/destroy/01_destroy_basic_pos.py b/tools/xm-test/tests/destroy/01_destroy_basic_pos.py index d76f280951..3d007b12a4 100644 --- a/tools/xm-test/tests/destroy/01_destroy_basic_pos.py +++ b/tools/xm-test/tests/destroy/01_destroy_basic_pos.py @@ -14,29 +14,21 @@ domain = XmTestDomain() # Start it try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("foo") # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() # Check the output of 'ls' if not re.search("proc", run["output"]): diff --git a/tools/xm-test/tests/destroy/05_destroy_byid_pos.py b/tools/xm-test/tests/destroy/05_destroy_byid_pos.py index 8c10e2a866..655b7a3e72 100644 --- a/tools/xm-test/tests/destroy/05_destroy_byid_pos.py +++ b/tools/xm-test/tests/destroy/05_destroy_byid_pos.py @@ -7,8 +7,7 @@ # Positive Test: # Test Description: # 1. Create a domain -# 2. Attach a console to the domain. -# 3. Destroy the domain by id +# 2. Destroy the domain by id import sys import re @@ -21,7 +20,7 @@ domain = XmTestDomain() # Start it try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/destroy/07_destroy_stale_pos.py b/tools/xm-test/tests/destroy/07_destroy_stale_pos.py index 9c5a69771f..83c796aacd 100644 --- a/tools/xm-test/tests/destroy/07_destroy_stale_pos.py +++ b/tools/xm-test/tests/destroy/07_destroy_stale_pos.py @@ -108,14 +108,11 @@ def runTests(tests): # Create a domain try: - domain.start() + console = domain.start() except DomainError, e: FAIL(str(e)) - # Attach a console and make sure it's live try: - console = XmConsole(domain.getName()) - console.sendInput("foo") console.runCmd("ls") except ConsoleError, e: FAIL(str(e)) diff --git a/tools/xm-test/tests/list/04_list_goodparm_pos.py b/tools/xm-test/tests/list/04_list_goodparm_pos.py index 0f567094aa..ec0e1cfddc 100644 --- a/tools/xm-test/tests/list/04_list_goodparm_pos.py +++ b/tools/xm-test/tests/list/04_list_goodparm_pos.py @@ -12,23 +12,17 @@ from XmTestLib import * domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - FAIL(str(e)) - - status, output = traceCommand("xm list %s" % domain.getName()) if status != 0: FAIL("`xm list %s' failed with invalid status %i != 0" % (domain.getName(), status)) -console.closeConsole() +domain.closeConsole() domain.stop() diff --git a/tools/xm-test/tests/memset/01_memset_basic_pos.py b/tools/xm-test/tests/memset/01_memset_basic_pos.py index 376ec82809..1eb81b5c2f 100644 --- a/tools/xm-test/tests/memset/01_memset_basic_pos.py +++ b/tools/xm-test/tests/memset/01_memset_basic_pos.py @@ -28,17 +28,14 @@ domain = XmTestDomain() # Start it try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName()) - console.sendInput("input") # Make sure it's up an running before we continue console.runCmd("ls") except ConsoleError, e: @@ -96,7 +93,7 @@ if domUmem != newmem: # quiesce everything # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/memset/03_memset_random_pos.py b/tools/xm-test/tests/memset/03_memset_random_pos.py index bb78c90cee..e8e2b350cd 100644 --- a/tools/xm-test/tests/memset/03_memset_random_pos.py +++ b/tools/xm-test/tests/memset/03_memset_random_pos.py @@ -14,7 +14,7 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to start domain:" diff --git a/tools/xm-test/tests/memset/04_memset_smallmem_pos.py b/tools/xm-test/tests/memset/04_memset_smallmem_pos.py index fd4c027949..6bce662b6d 100644 --- a/tools/xm-test/tests/memset/04_memset_smallmem_pos.py +++ b/tools/xm-test/tests/memset/04_memset_smallmem_pos.py @@ -11,7 +11,7 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to start domain: " @@ -19,8 +19,6 @@ except DomainError, e: FAIL(str(e)) try: - console = XmConsole(domain.getName()) - console.sendInput("input") # Make sure it's alive before we proceed console.runCmd("ls") except ConsoleError, e: diff --git a/tools/xm-test/tests/migrate/01_migrate_localhost_pos.py b/tools/xm-test/tests/migrate/01_migrate_localhost_pos.py index a172efef61..e71bf6935d 100644 --- a/tools/xm-test/tests/migrate/01_migrate_localhost_pos.py +++ b/tools/xm-test/tests/migrate/01_migrate_localhost_pos.py @@ -25,29 +25,21 @@ domain = XmTestDomain() # Start it try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it -try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - try: - # Activate the console - console.sendInput("foo") # Set a variable to check on the other side run = console.runCmd("foo=bar") except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() old_domid = domid(domain.getName()) @@ -68,11 +60,12 @@ if (old_domid == new_domid): # Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) + console = domain.getConsole() console.debugMe = True except ConsoleError, e: pass +console.setHistorySaveCmds(value=True) console.sendInput("ls") # Run 'ls' @@ -86,7 +79,7 @@ if not re.search("bar", run["output"]): FAIL("Migrated domain has been reset") # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/network-attach/01_network_attach_pos.py b/tools/xm-test/tests/network-attach/01_network_attach_pos.py index 8d4b635a54..f8e7f1a748 100644 --- a/tools/xm-test/tests/network-attach/01_network_attach_pos.py +++ b/tools/xm-test/tests/network-attach/01_network_attach_pos.py @@ -15,22 +15,14 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -45,7 +37,7 @@ if status: ## # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py b/tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py index 5b50714b9d..c985957dd9 100644 --- a/tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py +++ b/tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py @@ -17,22 +17,14 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("input") # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -51,7 +43,7 @@ if status: # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py b/tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py index 76da5891a3..b3e49e4c0e 100644 --- a/tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py +++ b/tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py @@ -17,25 +17,16 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it -try: - console = XmConsole(domain.getName(), historySaveCmds=True) - # network-detach is crashing, so we enable console debugging - # for now, so that reports include the oops - console.debugMe = True -except ConsoleError, e: - FAIL(str(e)) +console.debugMe = True try: - # Activate the console - console.sendInput("input") # Run 'ls' run = console.runCmd("ls") except ConsoleError, e: @@ -54,7 +45,7 @@ for i in range(10): FAIL(msg) # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/network/02_network_local_ping_pos.py b/tools/xm-test/tests/network/02_network_local_ping_pos.py index 3a673cf8cb..43bd380ec0 100644 --- a/tools/xm-test/tests/network/02_network_local_ping_pos.py +++ b/tools/xm-test/tests/network/02_network_local_ping_pos.py @@ -35,24 +35,14 @@ else: domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) - -# Attach a console -try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - try: - # Activate the console - console.sendInput("bhs") - # Bring up the "lo" interface. console.runCmd("ifconfig lo 127.0.0.1") diff --git a/tools/xm-test/tests/network/03_network_local_tcp_pos.py b/tools/xm-test/tests/network/03_network_local_tcp_pos.py index 2ca7b8dce0..3a8f07e37a 100644 --- a/tools/xm-test/tests/network/03_network_local_tcp_pos.py +++ b/tools/xm-test/tests/network/03_network_local_tcp_pos.py @@ -40,24 +40,14 @@ else: domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) - -# Attach a console -try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - try: - # Activate the console - console.sendInput("bhs") - # Bring up the "lo" interface. console.runCmd("ifconfig lo 127.0.0.1") diff --git a/tools/xm-test/tests/network/04_network_local_udp_pos.py b/tools/xm-test/tests/network/04_network_local_udp_pos.py index 35e51c4b5d..2ccd1d3814 100644 --- a/tools/xm-test/tests/network/04_network_local_udp_pos.py +++ b/tools/xm-test/tests/network/04_network_local_udp_pos.py @@ -39,24 +39,14 @@ else: domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) - -# Attach a console -try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - try: - # Activate the console - console.sendInput("bhs") - # Bring up the "lo" interface. console.runCmd("ifconfig lo 127.0.0.1") diff --git a/tools/xm-test/tests/network/05_network_dom0_ping_pos.py b/tools/xm-test/tests/network/05_network_dom0_ping_pos.py index 7e87c43959..7ab14c4833 100644 --- a/tools/xm-test/tests/network/05_network_dom0_ping_pos.py +++ b/tools/xm-test/tests/network/05_network_dom0_ping_pos.py @@ -40,22 +40,13 @@ else: domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) - -# Attach a console -try: - console = XmConsole(domain.getName(), historySaveCmds=True) - # Activate the console - console.sendInput("bhs") -except ConsoleError, e: - FAIL(str(e)) - try: # Add a suitable dom0 IP address dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg) diff --git a/tools/xm-test/tests/network/06_network_dom0_tcp_pos.py b/tools/xm-test/tests/network/06_network_dom0_tcp_pos.py index 7bd9c4a86b..1a14f537e4 100644 --- a/tools/xm-test/tests/network/06_network_dom0_tcp_pos.py +++ b/tools/xm-test/tests/network/06_network_dom0_tcp_pos.py @@ -40,22 +40,13 @@ else: domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) - -# Attach a console -try: - console = XmConsole(domain.getName(), historySaveCmds=True) - # Activate the console - console.sendInput("bhs") -except ConsoleError, e: - FAIL(str(e)) - try: # Add a suitable dom0 IP address dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg) diff --git a/tools/xm-test/tests/network/07_network_dom0_udp_pos.py b/tools/xm-test/tests/network/07_network_dom0_udp_pos.py index 05524989d9..27d1116fe6 100644 --- a/tools/xm-test/tests/network/07_network_dom0_udp_pos.py +++ b/tools/xm-test/tests/network/07_network_dom0_udp_pos.py @@ -40,22 +40,13 @@ else: domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) - -# Attach a console -try: - console = XmConsole(domain.getName(), historySaveCmds=True) - # Activate the console - console.sendInput("bhs") -except ConsoleError, e: - FAIL(str(e)) - try: # Add a suitable dom0 IP address dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg) diff --git a/tools/xm-test/tests/network/11_network_domU_ping_pos.py b/tools/xm-test/tests/network/11_network_domU_ping_pos.py index b35aea9dae..c5b9d6099f 100644 --- a/tools/xm-test/tests/network/11_network_domU_ping_pos.py +++ b/tools/xm-test/tests/network/11_network_domU_ping_pos.py @@ -25,19 +25,12 @@ def netDomain(ip): dom = XmTestDomain(extraConfig=config) try: - dom.start() + console = dom.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) - try: - # Attach a console - console = XmConsole(dom.getName(), historySaveCmds=True) - # Activate the console - console.sendInput("bhs") - except ConsoleError, e: - FAIL(str(e)) return console rc = 0 diff --git a/tools/xm-test/tests/network/12_network_domU_tcp_pos.py b/tools/xm-test/tests/network/12_network_domU_tcp_pos.py index 5a23fab164..e4001ea7b0 100644 --- a/tools/xm-test/tests/network/12_network_domU_tcp_pos.py +++ b/tools/xm-test/tests/network/12_network_domU_tcp_pos.py @@ -25,19 +25,12 @@ def netDomain(ip): dom = XmTestDomain(extraConfig=config) try: - dom.start() + console = dom.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) - try: - # Attach a console - console = XmConsole(dom.getName(), historySaveCmds=True) - # Activate the console - console.sendInput("bhs") - except ConsoleError, e: - FAIL(str(e)) return console rc = 0 diff --git a/tools/xm-test/tests/network/13_network_domU_udp_pos.py b/tools/xm-test/tests/network/13_network_domU_udp_pos.py index 4221206f5f..18d7f12c8d 100644 --- a/tools/xm-test/tests/network/13_network_domU_udp_pos.py +++ b/tools/xm-test/tests/network/13_network_domU_udp_pos.py @@ -25,19 +25,12 @@ def netDomain(ip): dom = XmTestDomain(extraConfig=config) try: - dom.start() + console = dom.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) - try: - # Attach a console - console = XmConsole(dom.getName(), historySaveCmds=True) - # Activate the console - console.sendInput("bhs") - except ConsoleError, e: - FAIL(str(e)) return console rc = 0 diff --git a/tools/xm-test/tests/pause/01_pause_basic_pos.py b/tools/xm-test/tests/pause/01_pause_basic_pos.py index 58306ae1a8..c104cd9790 100644 --- a/tools/xm-test/tests/pause/01_pause_basic_pos.py +++ b/tools/xm-test/tests/pause/01_pause_basic_pos.py @@ -20,29 +20,21 @@ domain = XmTestDomain() # Start it try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("foo") # Make sure a command succeeds run = console.runCmd("ls") except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() # Pause the domain status, output = traceCommand("xm pause %s" % domain.getName()) @@ -51,7 +43,8 @@ if status != 0: # Try to attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) + console = domain.getConsole() + console.setHistorySaveCmds(value=True) run = console.runCmd("ls") #If we get here, console attached to paused domain (unexpected) FAIL("console attached to supposedly paused domain") @@ -59,7 +52,7 @@ except ConsoleError, e: pass # Close the console -console.closeConsole() +domain.closeConsole() status, output = traceCommand("xm unpause %s" % domain.getName()) if status != 0: diff --git a/tools/xm-test/tests/pause/02_pause_badopt_neg.py b/tools/xm-test/tests/pause/02_pause_badopt_neg.py index 18eda67641..82173f14e6 100644 --- a/tools/xm-test/tests/pause/02_pause_badopt_neg.py +++ b/tools/xm-test/tests/pause/02_pause_badopt_neg.py @@ -11,7 +11,7 @@ from XmTestLib import * domain = XmTestDomain() try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/reboot/01_reboot_basic_pos.py b/tools/xm-test/tests/reboot/01_reboot_basic_pos.py index e33c93a28f..df006c4236 100644 --- a/tools/xm-test/tests/reboot/01_reboot_basic_pos.py +++ b/tools/xm-test/tests/reboot/01_reboot_basic_pos.py @@ -11,19 +11,14 @@ from XmTestLib import * domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - FAIL(str(e)) - -console.closeConsole() +domain.closeConsole() status, output = traceCommand("xm reboot %s" % domain.getName()) @@ -33,7 +28,7 @@ if status != 0: time.sleep(15) try: - console = XmConsole(domain.getName()) + console = domain.getConsole() except ConsoleError, e: FAIL(str(e)) @@ -43,7 +38,7 @@ try: except ConsoleError, e: FAIL(str(e)) -console.closeConsole() +domain.closeConsole() domain.destroy() diff --git a/tools/xm-test/tests/reboot/02_reboot_badopt_neg.py b/tools/xm-test/tests/reboot/02_reboot_badopt_neg.py index b0a23bb4a5..fc60ac2f18 100644 --- a/tools/xm-test/tests/reboot/02_reboot_badopt_neg.py +++ b/tools/xm-test/tests/reboot/02_reboot_badopt_neg.py @@ -11,7 +11,7 @@ from XmTestLib import * domain = XmTestDomain() try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/restore/01_restore_basic_pos.py b/tools/xm-test/tests/restore/01_restore_basic_pos.py index 9ea1ca4c53..4a61c2af01 100644 --- a/tools/xm-test/tests/restore/01_restore_basic_pos.py +++ b/tools/xm-test/tests/restore/01_restore_basic_pos.py @@ -18,7 +18,7 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" @@ -27,13 +27,11 @@ except DomainError, e: # Make sure the domain isn't DOA try: - console = XmConsole(domain.getName()) - console.sendInput("input") console.runCmd("foo=bar") except ConsoleError, e: FAIL(str(e)) -console.closeConsole() +domain.closeConsole() # Save it out try: @@ -67,7 +65,7 @@ if not isDomainRunning(domain.getName()): # Make sure it's alive try: - newConsole = XmConsole(domain.getName()) + newConsole = domain.getConsole() # Enable debug dumping because this generates a Oops on x86_64 newConsole.debugMe = True newConsole.sendInput("ls") @@ -77,7 +75,7 @@ try: except ConsoleError, e: FAIL("Restored domain is dead (%s)" % str(e)) -newConsole.closeConsole() +domain.closeConsole() # This only works because the domain # still has the same name diff --git a/tools/xm-test/tests/restore/04_restore_withdevices_pos.py b/tools/xm-test/tests/restore/04_restore_withdevices_pos.py index b3dfe73121..63b716da62 100644 --- a/tools/xm-test/tests/restore/04_restore_withdevices_pos.py +++ b/tools/xm-test/tests/restore/04_restore_withdevices_pos.py @@ -23,14 +23,11 @@ if s != 0: FAIL("Unable to mke2fs /dev/ram1 in dom0") try: - domain.start() + console = domain.start() except DomainError, e: FAIL(str(e)) try: - console = XmConsole(domain.getName()) - console.sendInput("foo") - run = console.runCmd("mkdir /mnt/a /mnt/b") if run["return"] != 0: FAIL("Unable to mkdir /mnt/a /mnt/b") @@ -67,7 +64,7 @@ try: except ConsoleError, e: FAIL(str(e)) -console.closeConsole() +domain.closeConsole() try: s, o = traceCommand("xm save %s /tmp/test.state" % domain.getName(), @@ -91,7 +88,7 @@ if s != 0: FAIL("xm restore exited with %i != 0" % s) try: - console = XmConsole(domain.getName()) + console = domain.getConsole() # Enable debug dumping, as this causes an Oops on x86_64 console.debugMe = True diff --git a/tools/xm-test/tests/save/01_save_basic_pos.py b/tools/xm-test/tests/save/01_save_basic_pos.py index b5a87ad91d..34270faa09 100644 --- a/tools/xm-test/tests/save/01_save_basic_pos.py +++ b/tools/xm-test/tests/save/01_save_basic_pos.py @@ -13,20 +13,14 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Make sure the domain isn't DOA -try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - FAIL(str(e)) - -console.closeConsole() +domain.closeConsole() # Save it out try: diff --git a/tools/xm-test/tests/save/03_save_bogusfile_neg.py b/tools/xm-test/tests/save/03_save_bogusfile_neg.py index 2612f74b1b..b8b99cd0b7 100644 --- a/tools/xm-test/tests/save/03_save_bogusfile_neg.py +++ b/tools/xm-test/tests/save/03_save_bogusfile_neg.py @@ -16,20 +16,14 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Make sure the domain isn't DOA -try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - FAIL(str(e)) - -console.closeConsole() +domain.closeConsole() # Save it out status, output = traceCommand("xm save %s /NOWHERE/test.state" % domain.getName()) diff --git a/tools/xm-test/tests/sedf/01_sedf_period_slice_pos.py b/tools/xm-test/tests/sedf/01_sedf_period_slice_pos.py index 6b6b95c97a..73392203cc 100644 --- a/tools/xm-test/tests/sedf/01_sedf_period_slice_pos.py +++ b/tools/xm-test/tests/sedf/01_sedf_period_slice_pos.py @@ -14,7 +14,7 @@ def get_sedf_params(domain): domain = XmTestDomain(extraConfig = {"sched":"sedf"}) try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/sedf/02_sedf_period_lower_neg.py b/tools/xm-test/tests/sedf/02_sedf_period_lower_neg.py index 91c0672243..73bf9f2963 100644 --- a/tools/xm-test/tests/sedf/02_sedf_period_lower_neg.py +++ b/tools/xm-test/tests/sedf/02_sedf_period_lower_neg.py @@ -16,7 +16,7 @@ def get_sedf_params(domain): domain = XmTestDomain(extraConfig = {"sched":"sedf"}) try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/sedf/03_sedf_slice_lower_neg.py b/tools/xm-test/tests/sedf/03_sedf_slice_lower_neg.py index 613a46a7b8..f9b07a4363 100644 --- a/tools/xm-test/tests/sedf/03_sedf_slice_lower_neg.py +++ b/tools/xm-test/tests/sedf/03_sedf_slice_lower_neg.py @@ -16,7 +16,7 @@ def get_sedf_params(domain): domain = XmTestDomain(extraConfig = {"sched":"sedf"}) try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/sedf/04_sedf_slice_upper_neg.py b/tools/xm-test/tests/sedf/04_sedf_slice_upper_neg.py index 8144021a1d..0d9d6d48b4 100644 --- a/tools/xm-test/tests/sedf/04_sedf_slice_upper_neg.py +++ b/tools/xm-test/tests/sedf/04_sedf_slice_upper_neg.py @@ -14,7 +14,7 @@ def get_sedf_params(domain): domain = XmTestDomain(extraConfig = {"sched":"sedf"}) try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/sedf/05_sedf_extratime_pos.py b/tools/xm-test/tests/sedf/05_sedf_extratime_pos.py index 4ca28075ea..702d64bedc 100644 --- a/tools/xm-test/tests/sedf/05_sedf_extratime_pos.py +++ b/tools/xm-test/tests/sedf/05_sedf_extratime_pos.py @@ -14,7 +14,7 @@ def get_sedf_params(domain): domain = XmTestDomain(extraConfig = {"sched":"sedf"}) try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/sedf/06_sedf_extratime_disable_neg.py b/tools/xm-test/tests/sedf/06_sedf_extratime_disable_neg.py index 202389fe1b..e0a7974106 100644 --- a/tools/xm-test/tests/sedf/06_sedf_extratime_disable_neg.py +++ b/tools/xm-test/tests/sedf/06_sedf_extratime_disable_neg.py @@ -14,7 +14,7 @@ def get_sedf_params(domain): domain = XmTestDomain(extraConfig = {"sched":"sedf"}) try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/shutdown/01_shutdown_basic_pos.py b/tools/xm-test/tests/shutdown/01_shutdown_basic_pos.py index e1a1531f7c..bfedf65b10 100644 --- a/tools/xm-test/tests/shutdown/01_shutdown_basic_pos.py +++ b/tools/xm-test/tests/shutdown/01_shutdown_basic_pos.py @@ -19,29 +19,21 @@ domain = XmTestDomain() # Start it try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("foo") # Make sure a command succeeds run = console.runCmd("ls /bin") except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) status, output = traceCommand("xm shutdown %s" % domain.getName()) diff --git a/tools/xm-test/tests/shutdown/02_shutdown_badparm_neg.py b/tools/xm-test/tests/shutdown/02_shutdown_badparm_neg.py index 8ec2a5b3c2..6a70ae2ce3 100644 --- a/tools/xm-test/tests/shutdown/02_shutdown_badparm_neg.py +++ b/tools/xm-test/tests/shutdown/02_shutdown_badparm_neg.py @@ -20,7 +20,7 @@ domain = XmTestDomain() # Start it try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/sysrq/02_sysrq_sync_pos.py b/tools/xm-test/tests/sysrq/02_sysrq_sync_pos.py index 3aea592a0e..e6d73fbf09 100644 --- a/tools/xm-test/tests/sysrq/02_sysrq_sync_pos.py +++ b/tools/xm-test/tests/sysrq/02_sysrq_sync_pos.py @@ -17,20 +17,13 @@ domain = XmTestDomain() # Start it try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it -try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - - status, output = traceCommand("xm sysrq %s s" % domain.getName()) if status != 0: @@ -40,15 +33,13 @@ if status != 0: # Run 'ls' try: - # Activate the console - console.sendInput("foo") # Check the dmesg output on the domU run = console.runCmd("dmesg | grep Emerg\n") except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() # Stop the domain (nice shutdown) domain.stop() diff --git a/tools/xm-test/tests/sysrq/03_sysrq_withreboot_pos.py b/tools/xm-test/tests/sysrq/03_sysrq_withreboot_pos.py index 71cc9f1fb4..d314b40ccf 100644 --- a/tools/xm-test/tests/sysrq/03_sysrq_withreboot_pos.py +++ b/tools/xm-test/tests/sysrq/03_sysrq_withreboot_pos.py @@ -13,7 +13,7 @@ if ENABLE_HVM_SUPPORT: domain = XmTestDomain() try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create domain:" @@ -27,12 +27,6 @@ if status != 0: # Wait for the reboot to finish time.sleep(20) -try: - console = XmConsole(domain.getName()) - console.sendInput("input") -except ConsoleError, e: - FAIL(str(e)) - status, output = traceCommand("xm sysrq %s s" % domain.getName()) if status != 0: FAIL("sysrq failed with %i != 0" % status) diff --git a/tools/xm-test/tests/unpause/01_unpause_basic_pos.py b/tools/xm-test/tests/unpause/01_unpause_basic_pos.py index d459c6abd1..7bd2f1f20e 100644 --- a/tools/xm-test/tests/unpause/01_unpause_basic_pos.py +++ b/tools/xm-test/tests/unpause/01_unpause_basic_pos.py @@ -22,29 +22,21 @@ domain = XmTestDomain() # Start it try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra FAIL(str(e)) -# Attach a console to it try: - console = XmConsole(domain.getName(), historySaveCmds=True) -except ConsoleError, e: - FAIL(str(e)) - -try: - # Activate the console - console.sendInput("foo") # Make sure a command succeeds run = console.runCmd("ls") except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() seed(time.time()) @@ -69,13 +61,13 @@ if status != 0: # Are we still alive after all that? try: - console = XmConsole(domain.getName(), historySaveCmds=True) + console = domain.getConsole() run = console.runCmd("ls") except ConsoleError, e: FAIL(str(e)) # Close the console -console.closeConsole() +domain.closeConsole() if run["return"] != 0: FAIL("console failed to attach to supposedly unpaused domain") diff --git a/tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py b/tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py index ac1eefa1b8..08691255cf 100644 --- a/tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py +++ b/tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py @@ -42,7 +42,7 @@ if smpConcurrencyLevel() <= 1: domain = XmTestDomain(extraConfig={"vcpus":2}) try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py b/tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py index df6f7deb6d..f254401448 100644 --- a/tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py +++ b/tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py @@ -20,7 +20,7 @@ if smpConcurrencyLevel() <= 1: domain = XmTestDomain() try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print "Failed to create test domain because:" diff --git a/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py b/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py index f5c428e1ca..a427bf2fde 100644 --- a/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py +++ b/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py @@ -16,7 +16,7 @@ config = {"vtpm":"instance=1,backend=0"} domain = XmTestDomain(extraConfig=config) try: - domain.start() + domain.start(noConsole=True) except DomainError, e: if verbose: print e.extra diff --git a/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py b/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py index feeb6cb42a..d554dfb717 100644 --- a/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py +++ b/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py @@ -16,7 +16,7 @@ config = {"vtpm":"instance=1,backend=0"} domain = XmTestDomain(extraConfig=config) try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print e.extra @@ -25,12 +25,6 @@ except DomainError, e: domName = domain.getName() -try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - vtpm_cleanup(domName) - FAIL(str(e)) - try: console.sendInput("input") except ConsoleError, e: @@ -49,7 +43,7 @@ if re.search("No such file",run["output"]): vtpm_cleanup(domName) FAIL("TPM frontend support not compiled into (domU?) kernel") -console.closeConsole() +domain.closeConsole() domain.stop() diff --git a/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py b/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py index 7e291763af..27cd4eaa71 100644 --- a/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py +++ b/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py @@ -15,9 +15,10 @@ import os.path config = {"vtpm":"instance=1,backend=0"} domain = XmTestDomain(extraConfig=config) +consoleHistory = "" try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print e.extra @@ -26,12 +27,6 @@ except DomainError, e: domName = domain.getName() -try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - vtpm_cleanup(domName) - FAIL(str(e)) - try: console.sendInput("input") except ConsoleError, e: @@ -50,19 +45,21 @@ if re.search("No such file",run["output"]): vtpm_cleanup(domName) FAIL("TPM frontend support not compiled into (domU?) kernel") -console.closeConsole() +consoleHistory = console.getHistory() +domain.closeConsole() try: status, ouptut = traceCommand("xm save %s %s.save" % (domName, domName), timeout=30) + except TimeoutError, e: - saveLog(console.getHistory()) + saveLog(consoleHistory) vtpm_cleanup(domName) FAIL(str(e)) if status != 0: - saveLog(console.getHistory()) + saveLog(consoleHistory) vtpm_cleanup(domName) FAIL("xm save did not succeed") @@ -72,19 +69,19 @@ try: timeout=30) except TimeoutError, e: os.remove("%s.save" % domName) - saveLog(console.getHistory()) + saveLog(consoleHistory) vtpm_cleanup(domName) FAIL(str(e)) os.remove("%s.save" % domName) if status != 0: - saveLog(console.getHistory()) + saveLog(consoleHistory) vtpm_cleanup(domName) FAIL("xm restore did not succeed") try: - console = XmConsole(domain.getName()) + console = domain.getConsole() except ConsoleError, e: vtpm_cleanup(domName) FAIL(str(e)) @@ -96,7 +93,7 @@ except ConsoleError, e: vtpm_cleanup(domName) FAIL(str(e)) -console.closeConsole() +domain.closeConsole() domain.stop() diff --git a/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py b/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py index 33ef06bf30..2f68d38dd5 100644 --- a/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py +++ b/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py @@ -15,9 +15,10 @@ import os.path config = {"vtpm":"instance=1,backend=0"} domain = XmTestDomain(extraConfig=config) +consoleHistory = "" try: - domain.start() + console = domain.start() except DomainError, e: if verbose: print e.extra @@ -26,12 +27,6 @@ except DomainError, e: domName = domain.getName() -try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - vtpm_cleanup(domName) - FAIL(str(e)) - try: console.sendInput("input") except ConsoleError, e: @@ -50,7 +45,8 @@ if re.search("No such file",run["output"]): vtpm_cleanup(domName) FAIL("TPM frontend support not compiled into (domU?) kernel") -console.closeConsole() +consoleHistory = console.getHistory() +domain.closeConsole() old_domid = domid(domName) @@ -59,12 +55,12 @@ try: domName, timeout=90) except TimeoutError, e: - saveLog(console.getHistory()) + saveLog(consoleHistory) vtpm_cleanup(domName) FAIL(str(e)) if status != 0: - saveLog(console.getHistory()) + saveLog(consoleHistory) vtpm_cleanup(domName) FAIL("xm migrate did not succeed. External device migration activated?") @@ -77,7 +73,7 @@ if (old_domid == new_domid): FAIL("xm migrate failed, domain id is still %s" % old_domid) try: - console = XmConsole(domain.getName()) + console = domain.getConsole() except ConsoleError, e: vtpm_cleanup(domName) FAIL(str(e)) @@ -89,7 +85,7 @@ except ConsoleError, e: vtpm_cleanup(domName) FAIL(str(e)) -console.closeConsole() +domain.closeConsole() domain.stop()